// HJ71 字符串通配符
// https://www.nowcoder.com/practice/43072d50a6eb44d2a6c816a283b02036

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int ismatch(char s1[], int len1, char s2[], int len2) {
  int dp[len1 + 1][len2 + 1];
  dp[0][0] = 1;

  int i, j;
  for (i = 1; i < len2 + 1; i++) dp[0][i] = 0;
  for (i = 1; i < len1 + 1; i++) {
    if (s1[0] == '*')
      dp[i][0] = 1;
    else
      dp[i][0] = 0;
  }

  for (i = 1; i < len1 + 1; i++) {
    for (j = 1; j < len2 + 1; j++) {
      if (s1[i] == '*') {
        dp[i][j] = dp[i - 1][j] || dp[i][j - 1] || dp[i - 1][j - 1];
      } else {
        if (s1[i] == s2[j] || s1[i] == '?')
          dp[i][j] = dp[i - 1][j - 1];
        else
          dp[i][j] = 0;
      }
    }
  }
  return dp[len1][len2];
}

int main() {
  char s1[1000];
  char s2[1000];
  while (scanf("%s", s1) != EOF) {
    scanf("%s", s2);
    if (ismatch(s1, strlen(s1), s2, strlen(s2)))
      printf("true\n");
    else
      printf("false\n");
  }
}
